<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    
      function hello(name,printFn)
      {
            var str = "你好" + name
            printFn(str)
      }

      function printConsole(str)
      {
        console.log(str);
     }

       function printWindow(str)
      {
        alert(str);
     }

      hello ("张三",printWindow)
    
    </script>
</body>
</html>